package hello;

import org.springframework.data.domain.Example;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping
@CrossOrigin(origins = "*")
public class a {

    @Resource
    ApplyRepository applyRepository;

    @RequestMapping("s")
    public String[] a(@RequestBody List<Apply> a, @RequestParam(defaultValue = "1") String page) throws IOException {
        System.out.println(a);
        applyRepository.save(a);


        return new String[0];
    }


    @RequestMapping("a")
    private List<Apply> applied(String gs){
        System.out.println(gs);
        Apply apply=new Apply();
        apply.gs=gs;
        Example<Apply> e=Example.of(apply);
        List<Apply> r=applyRepository.findAll(e);
        System.out.println(r);
        return r ;
    }

    @RequestMapping
    public String[] b(@RequestBody Map<String,String> a)  {
        System.out.println(a.get("html"));
        return new String[0];
    }

    @RequestMapping("ul")
    public void k( MultipartFile file){
        System.out.println(file.getName());
        System.out.println(file.getOriginalFilename());
        System.out.println(file.getSize());
    }
}
